<?php

/**
 * demo_data类
 *
 * @since 1.0 <2015-10-24> SoChishun <14507247@qq.com> Added.
 */
$data = array(
    array('category_name' => '首页', 'type_id' => 4),
    array('category_name' => '关于我们', 'type_id' => 2, 'children' => array(
            array('category_name' => '公司简介', 'type_id' => 1),
            array('category_name' => '董事会寄语', 'type_id' => 1),
            array('category_name' => '企业文化', 'type_id' => 1),
            array('category_name' => '荣誉资质', 'type_id' => 1),
            array('category_name' => '组织架构', 'type_id' => 1),
            array('category_name' => '环境展示', 'type_id' => 1),
            array('category_name' => '经验团队', 'type_id' => 1),
            array('category_name' => '分析师介绍', 'type_id' => 1),
            array('category_name' => '联系我们', 'type_id' => 1),
        )
    ),
    array('category_name' => '新闻中心', 'type_id' => 2, 'children' => array(
            array('category_name' => '本站公告', 'type_id' => 2),
            array('category_name' => '每日要闻', 'type_id' => 2),
            array('category_name' => '公司动态', 'type_id' => 2),
            array('category_name' => '财经资讯', 'type_id' => 2),
            array('category_name' => '产品资讯', 'type_id' => 2),
            array('category_name' => '行情分析', 'type_id' => 2),
            array('category_name' => '新手的成功途径', 'type_id' => 2),
        )),
    array('category_name' => '产品中心', 'type_id' => 3, 'children' => array(
            array('category_name' => '产品介绍', 'type_id' => 3, 'children' => array(
                    array('category_name' => '产品优势', 'type_id' => 3),
                    array('category_name' => '交易细则', 'type_id' => 3),
                    array('category_name' => '产品制度', 'type_id' => 3),
                )),
            array('category_name' => '上市品种', 'type_id' => 3, 'children' => array(
                    array('category_name' => '贵重金属', 'type_id' => 3),
                    array('category_name' => '化工产品', 'type_id' => 3),
                    array('category_name' => '建材产品', 'type_id' => 3),
                    array('category_name' => '轻纺产品', 'type_id' => 3),
                    array('category_name' => '农林产品', 'type_id' => 3),
                )),
        )),
    array('category_name' => '下载中心', 'type_id' => 5, 'children' => array(
            array('category_name' => '软件下载', 'type_id' => 5),
            array('category_name' => '手机软件下载', 'type_id' => '5'),
            array('category_name' => '绑定流程下载', 'type_id' => '5'),
            array('category_name' => '出入金下载', 'type_id' => '5'),
        )),
    array('category_name' => '服务指南', 'type_id' => 2, 'children' => array(
            array('category_name' => '新手入门', 'type_id' => 1),
            array('category_name' => '开户流程', 'type_id' => 1),
            array('category_name' => '交易规则', 'type_id' => 1),
            array('category_name' => '客户服务', 'type_id' => 1),
            array('category_name' => '常见问题', 'type_id' => 1, 'children' => array(
                    array('category_name' => '操作问题', 'type_id' => 1),
                    array('category_name' => '交易问题', 'type_id' => 1),
                    array('category_name' => '账户问题', 'type_id' => 1),
                )),
            array('category_name' => '在线咨询', 'type_id' => 4),
        )),
    array('category_name' => '招商合作', 'type_id' => 2, 'children' => array(
            array('category_name' => '合作优势', 'type_id' => 1),
            array('category_name' => '合作条件', 'type_id' => 1),
            array('category_name' => '合作流程', 'type_id' => 1),
        )),
    array('category_name' => '在线咨询', 'type_id' => 4),
);

$i = 0;

function echoxx($data, $pid = 0) {
    global $i;
    foreach ($data as $row) {
        $fields = array();
        $values = array();
        foreach ($row as $key => $value) {
            if ('children' == $key) {
                continue;
            }
            $fields[] = $key;
            $values[] = $value;
        }
        $i++;
        echo 'insert into t_porg_document_category (id,pid,' . implode(',', $fields) . ') values (' . $i . ',' . $pid . ',\'' . implode("','", $values) . '\');<br />';
        if (!empty($row['children'])) {
            echoxx($row['children'], $i);
        }
    }
}

echoxx($data);
echo 'update t_porg_document_category set status=1;';
